'''
Created on Jul 14, 2012

@author: catapult
'''

import pygame
import move

class Button(pygame.sprite.Sprite):
    
    def __init__(self, dispMode):
        self.dispMode = dispMode
        pygame.sprite.Sprite.__init__(self)
        
class AttackChoiceButton(Button):
    
    def __init__(self):
        Button.__init__(self, 1)
        self.image = pygame.image.load("../images/buttons/blankbutton.png")
        self.rect = self.image.get_rect()
        self.font = pygame.font.SysFont("Arial", 16, False, False)
        self.text = self.font.render("Attack", False, (255, 255, 255))
        self.image.blit(self.text, [self.image.get_size()[0] / 2 - self.text.get_size()[0]  / 2, self.image.get_size()[1] / 2 - self.text.get_size()[1] / 2])

class PokeChoiceButton(Button):
    
    def __init__(self):
        Button.__init__(self, 2)
        self.image = pygame.image.load("../images/buttons/blankbutton.png")
        self.rect = self.image.get_rect()
        self.font = pygame.font.SysFont("Arial", 16, False, False)
        self.text = self.font.render("Pokemon", False, (255, 255, 255))
        self.image.blit(self.text, [self.image.get_size()[0] / 2 - self.text.get_size()[0] / 2, self.image.get_size()[1] / 2 - self.text.get_size()[1] / 2])

class ItemChoiceButton(Button):
    
    def __init__(self):
        Button.__init__(self, 3)
        self.image = pygame.image.load("../images/buttons/blankbutton.png")
        self.rect = self.image.get_rect()
        self.font = pygame.font.SysFont("Arial", 16, False, False)
        self.text = self.font.render("Bag", False, (255, 255, 255))
        self.image.blit(self.text, [self.image.get_size()[0] / 2 - self.text.get_size()[0] / 2, self.image.get_size()[1] / 2 - self.text.get_size()[1] / 2])

class FleeChoiceButton(Button):
    
    def __init__(self):
        Button.__init__(self, 4)
        self.image = pygame.image.load("../images/buttons/blankbutton.png")
        self.rect = self.image.get_rect()
        self.font = pygame.font.SysFont("Arial", 16, False, False)
        self.text = self.font.render("Flee", False, (255, 255, 255))
        self.image.blit(self.text, [self.image.get_size()[0] / 2 - self.text.get_size()[0] / 2, self.image.get_size()[1] / 2 - self.text.get_size()[1] / 2])
        
class AttackButton(Button):
    
    def __init__(self, move):
        Button.__init__(self, 5)
        self.move = move
        dispName = self.move.name
        ppC = self.move.ppC
        ppT = self.move.ppT
        type = self.move.type
        if(type == "electric"):
            type = "electr"
        elif(type == "psychic"):
            type = "psychc"
        self.image = pygame.image.load("../images/buttons/" + type + "button.png")
        self.font = pygame.font.SysFont("Arial", 14, True, False)
        moveNameB = self.font.render(dispName, False, (113, 139, 112))
        self.image.blit(moveNameB, [self.image.get_size()[0] / 2 - moveNameB.get_size()[0] / 2 + 1, 12 + 1])
        moveName = self.font.render(dispName, False, (255, 255, 255))
        self.image.blit(moveName, [self.image.get_size()[0] / 2 - moveName.get_size()[0] / 2, 12])
        self.font = pygame.font.SysFont("Arial", 14, False, False)
        if( ppC / ppT <= .5 and ppC / ppT > .25):
            pp11 = self.font.render(str(ppC), False, (215, 172, 0))
        elif(ppC / ppT > .5):
            pp11 = self.font.render(str(ppC), False, (0, 0, 0))
        elif( ppC / ppT <= .25 and ppC > 0):
            pp11 = self.font.render(str(ppC), False, (231, 96, 13))
        else:
            pp11 = self.font.render(str(ppC), False, (190, 40, 33))
        
        
        
